{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (<ipython-input-1-a0e3e07c3629>, line 5)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-1-a0e3e07c3629>\"\u001b[1;36m, line \u001b[1;32m5\u001b[0m\n\u001b[1;33m    : -1].values // .iloc[行,列]\u001b[0m\n\u001b[1;37m                    ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "dataset = pd.read_csv('Data .csv') // 读取csv文件\n",
    "X = dataset.iloc[ : ,\n",
    "                 : -1].values // .iloc[行,列]\n",
    "Y = dataset.iloc[ : , 3].values \n",
    "// : 全部行 or 列;[a]第a行 or 列\n",
    "// [a,b,c]第 a,b,c 行 or 列\n",
    "    from sklearn.preprocessing import Imputer\n",
    "    imputer = Imputer(missing_values = \"NaN\", strategy = \"mean\",axis = 0)\n",
    "    imputer = imputer.fit(X[ : , 1:3])\n",
    "    X[ : , 1:3] = imputer.transform(X[ : , 1:3])\n",
    "    from sklearn.preprocessing import LabelEncoder ,OneHotEncoderEncoder()X[ : , 0] = labelencoder_X.fit_transform(X[ : , 0])\n",
    "    onehotencoder = OneHotEncoder(categorical_features = [0])\n",
    "    X = onehotencoder.fit_transform(X).toarr\n",
    "    labelencoder_Y = LabelEncoder()\n",
    "    Y = labelencoder_Y.fit_transform(Y)\n",
    "    from sklearn.model_selection import train_tese_split\n",
    "    X_train, X_test, Y_train, Y_test = train_tese_split(X ,Y ,test_size = 0.2, random_state = 0)\n",
    "    from sklearn.preprocessing import StandardScaler \n",
    "    sc_X = StandardScaler()\n",
    "    X_train = sc_X.fit_transform(X_train)\n",
    "    X_tese = sc_X.transform(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
